package Tydzien2Test;
import static org.junit.Assert.*;

import org.junit.Test;

import Tydzien2.MainParameters;


public class MainParametersTest 
{

	@Test
	public void testMain() 
	{
		String[] args = {"2", "3", "+"};
		MainParameters.main(args);
		assertEquals(5.0, MainParameters.result, 0.000001);
	
	}
	
	@Test
	public void testMainTooManyArguments()
	{
		String[] args = {"2.4", "5.3", "-", "12.3"};
		MainParameters.main(args);
		assertEquals(Double.NaN, MainParameters.result , 0.0);
	}

	@Test
	public void testMainNotEnoughArguments()
	{
		String[] args = {"2.4", "5.3"};
		MainParameters.main(args);
		assertEquals(Double.NaN, MainParameters.result, 0.0);
	}
	
	@Test
	public void testMainWrongArguments()
	{
		String[] args1 = {"jablko", "2.0", "/"};
		String[] args2 = {"2.4", "5.3", "1.2"};
		MainParameters.main(args1);
		assertEquals(Double.NaN, MainParameters.result, 0.0);
		MainParameters.main(args2);    
    	assertEquals(Double.NaN, MainParameters.result, 0.0);
	}
}
